package com.dkts.oil.test.path;

import lombok.Data;

@Data
public class TempGridInfo {
    public String code;
    public int isAdvice= 0;

    public TempGridInfo parent;
    public double x;
    public double y;

    public int indexX;

    public int indexY;

    public double cost; // 从起点到当前节点的成本
    public double heuristic; // 启发式成本（到目标的预估成本）
    public TempGridInfo(){

    }
    public TempGridInfo(String code, int isAdvice, double x, double y){
        this.code = code;
        this.isAdvice = isAdvice;
        this.x=x;
        this.y=y;
    }

    public TempGridInfo(double x, double y){
        this.x=x;
        this.y=y;
    }

    public TempGridInfo(double x, double y, String code){
        this.x=x;
        this.y=y;
        this.code=code;
    }

    public TempGridInfo(String code, int isAdvice, double x, double y, int newX, int newY, TempGridInfo current) {
        this.code = code;
        this.isAdvice = isAdvice;
        this.x = x;
        this.y = y;
        this.indexX = newX;
        this.indexY = newY;
        this.parent = current;
    }

    public double getTotalCost() {
        return cost + heuristic;
    }

    public String getGridCode() {
        // 将坐标转换为北斗网格编码（假设每个单位为1）
        return getCode();
    }

    public TempGridInfo(double x, double y, double cost, double heuristic, TempGridInfo parent) {
        this.x = x;
        this.y = y;
        this.cost = cost;
        this.heuristic = heuristic;
        this.parent = parent;
    }

    public TempGridInfo(String code, int isAdvice, double x, double y, int indexX, int indexY){
        this.code = code;
        this.isAdvice = isAdvice;
        this.x=x;
        this.y=y;
        this.indexX=indexX;
        this.indexY=indexY;
    }

}
